<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:72:"D:\PHPTutorial\WWW\demo\public/../application/admin\view\user\index.html";i:1543296222;s:63:"D:\PHPTutorial\WWW\demo\application\admin\view\common\head.html";i:1541553786;s:65:"D:\PHPTutorial\WWW\demo\application\admin\view\common\footer.html";i:1515220430;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>上海顾云数据科技中心</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/admin/layui/css/layui.css">
    <link rel="stylesheet" href="/static/admin/build/css/app.css" media="all">
</head>
<style>
    .hidden{
        display: none;
    }

</style>
<style type="text/css">
    .file {
        position: relative;
        display: inline-block;
        background: #029587;
        border: 1px solid #029587;
        border-radius: 3px;
        padding: 4px 12px;
        overflow: hidden;
        color: #029587;
        text-decoration: none;
        text-indent: 0;
        line-height: 28.5px;
    }
    .file input {
        position: absolute;
        font-size: 100px;
        right: 0;
        top: 0;
        opacity: 0;
    }
    .import_file:hover{
        cursor: pointer;
    }
    /*.file:hover {
        cursor: pointer;
        background: #AADFFD;
        border-color: #78C3F3;
        color: #004974;
        text-decoration: none;
    }*/
</style>
<!--员工发布&#45;&#45;说天喊地-->
<div style="overflow-x: hidden;width: 96%;margin: auto;padding-top: 1rem;">
    <blockquote class="layui-elem-quote layui-text">
        <div class="demoTable layui-form">
            <!--<table class="layui-hide" id="LAY_table_user" lay-filter="user"></table>-->
            <div class="demoTable layui-form">
                <div class="layui-input-inline">
                    <input type="text" placeholder="请输入员工名称" name="name"  autocomplete="off" class="layui-input">
                </div>
                <button class="layui-btn " data-type="reload" ><i class="layui-icon">&#xe615;</i>搜索</button>
                <button class="layui-btn addInfo"><i class="layui-icon">&#xe654;</i>添加</button>
                <!-- <button class="layui-btn import"><i class="layui-icon">&#xe681;</i>导入</button> -->
                <div class="layui-input-inline import_file" style="margin-top: 0.29rem">
                <form action="<?php echo url('admin/Excel/importFile'); ?>" enctype="multipart/form-data" method="post">
                    <a href="#" class="file"><span style="color: #ffffff;"><i class="layui-icon">&#xe681;</i>&nbsp;选择文件</span>
                        <input type="file" name="upload" id="">
                    </a>
                    <a href="#" class="file"><input type="submit" name=""><span style="color: #ffffff;"><i class="layui-icon">&#xe681;</i>&nbsp;导入用户</span></a>
                </form>
                </div>
                
            </div>
        </div>
    </blockquote>
    <div class="demoTable layui-for">
        <table class="layui-table" lay-data="{height: 'full-150', url:'<?php echo url('User/getUserInfo'); ?>',edit:true, page:true, id:'testReload',loading:true}" lay-filter="demo">
            <thead>
            <tr>
                <th lay-data="{field:'name',width:80,fixed: true,templet:'#remb'}">姓名</th>
                <th lay-data="{field:'sex', width:70,templet: '#sex'}">性别</th>
                <th lay-data="{field:'age', width:70}">年龄</th>
                <th lay-data="{field:'phone',width:150}">手机号码</th>
                <!--<th lay-data="{field:'secret_number',width:180}">密号</th>-->
                <th lay-data="{field:'project_id',width:180}">所属项目</th>
                <th lay-data="{field:'interview_company',width:180}">面试公司</th>
                <th lay-data="{field:'is_social', width:120, templet: '#is_social'}">是否交社保</th>
                <th lay-data="{field:'social_base', width:120}">社保基数</th>
                <th lay-data="{field:'social_area', width:120}">社保地区</th>
                <th lay-data="{field:'is_stay', width:120, templet: '#is_stay'}">是否住宿</th>
                <th lay-data="{field:'is_contract', width:120, templet: '#is_contract'}">是否签合同</th>
                <th lay-data="{field:'admin_id', width:120,}">所属人</th>
                <th lay-data="{field:'depart_id', width:120,}">所属入职部门</th>
                <th lay-data="{field:'source', width:120,}">招聘方式</th>
                <th lay-data="{field:'status', width:120, templet: '#status'}">状态</th>
                <th lay-data="{fixed: 'is_hot', width:200,fixed: 'right', align:'left', toolbar: '#barDemo'}">操作</th>
            </tr>
            </thead>
        </table>
        <script type="text/html" id="barDemo">
            <a title="编辑" lay-event="edit" href="#"><i class="layui-icon" style="font-size: 25px; color:#029587;line-height: 30px">&#xe642;</i></a>
            <a title="删除" lay-event="del" href="#"><i class="layui-icon" style="font-size: 25px; color:#029587;line-height: 30px">&#xe640;</i></a>
        </script>
        <script type="text/html" id="contentTpl" lay-event="detail_content">
            <span>{{ d.describe }}</span>
        </script>
        <script type="text/html" id="status">
            {{#  if(d.status == 1){ }}
            <span style="color: #5FB878" >正常</span>
            {{#  }else{ }}
            <span style="color: red">禁用</span>
            {{#  } }}
        </script>
        <script type="text/html" id="is_social">
            {{#  if(d.is_social == 1){ }}
            <span style="color: #5FB878" >是</span>
            {{#  }else{ }}
            <span style="color: red">否</span>
            {{#  } }}
        </script>
        <script type="text/html" id="is_stay">
            {{#  if(d.is_stay == 1){ }}
            <span style="color: #5FB878" >是</span>
            {{#  }else{ }}
            <span style="color: red" >否</span>
            {{#  } }}
        </script>
        <script type="text/html" id="is_contract">
            {{#  if(d.is_contract == 1){ }}
            <span style="color: #5FB878" >是</span>
            {{#  }else{ }}
            <span style="color: red">否</span>
            {{#  } }}
        </script>
        <script type="text/html" id="sex">
            {{#  if(d.sex == 1){ }}
            <span  >男</span>
            {{#  }else{ }}
            <span>女</span>
            {{#  } }}
        </script>


        <script type="text/html" id="company_type">
            {{#  if(d.company_type == 1){ }}
            <span >保险公司人员</span>
            {{#  } }}
            {{#  if(d.company_type == 2){ }}
            <span >代录人</span>
            {{#  } }}
            {{#  if(d.company_type == 3){ }}
            <span >被保险人</span>
            {{#  } }}
            {{#  if(d.company_type == 4){ }}
            <span >业务员</span>
            {{#  } }}
        </script>
    </div>
    <script src="/static/admin/layui/layui.js"></script>
<script src="/static/common/js/jquery.min.js"></script>
<script>
//    图片放大显示
    $('.select_img').on('click',function () {
        var img_url=$(this).data('content');
        layer.open({
            type: 1,
            title: false,
            closeBtn: 0,
            area: ['50%','80%'],
            skin: 'layui-layer-nobg', //没有背景色
            shadeClose: true,
            content: '<img src="'+img_url+'" />',
        });
    })
    //文件上传
    layui.use('upload', function(){
        var $ = layui.jquery
            ,upload = layui.upload;
        //多文件列表示例
        var demoListView = $('#demoList')
            ,uploadListIns = upload.render({
            elem: '#testList'
            ,url: '<?php echo url("Upload/file_images"); ?>'
            ,accept: 'file'
            ,multiple: true
            ,auto: false
            ,bindAction: '#testListAction'
            ,choose: function(obj){
                var files = obj.pushFile(); //将每次选择的文件追加到文件队列
                //读取本地文件
                obj.preview(function(index, file, result){
                    var tr = $(['<tr id="upload-'+ index +'">'
                        ,'<td>'+ file.name +'</td>'
                        ,'<td>'+ (file.size/1014).toFixed(1) +'kb</td>'
                        ,'<td>等待上传</td>'
                        ,'<td>'
                        ,'<button class="layui-btn layui-btn-mini demo-reload layui-hide">重传</button>'
                        ,'<button class="layui-btn layui-btn-mini layui-btn-danger demo-delete">删除</button>'
                        ,'</td>'
                        ,'</tr>'].join(''));

                    //单个重传
                    tr.find('.demo-reload').on('click', function(){
                        obj.upload(index, file);
                    });

                    //删除
                    tr.find('.demo-delete').on('click', function(){
                        delete files[index]; //删除对应的文件
                        tr.remove();
                    });

                    demoListView.append(tr);
                });
            }
            ,done: function(res, index, upload){
                if(res.code == 200){ //上传成功
                    var tr = demoListView.find('tr#upload-'+ index)
                        ,tds = tr.children();
                    tds.eq(2).html('<span style="color: #5FB878;">上传成功</span><input type="hidden" name="images['+index+']" value="'+res.data.src+'">');
                    tds.eq(3).html(''); //清空操作
                    delete files[index]; //删除文件队列已经上传成功的文件
                    return;
                }
                this.error(index, upload);
            }
            ,error: function(index, upload){
                var tr = demoListView.find('tr#upload-'+ index)
                    ,tds = tr.children();
                tds.eq(2).html('<span style="color: #FF5722;">上传失败</span>');
                tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传
            }
        });

        //普通图片上传 单图片上传
        var uploadInst = upload.render({
            elem: '#image'
            ,url: '<?php echo url("Upload/file_images"); ?>'
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#show_image').attr('src', result); //图片链接（base64）
                });
            }
            ,done: function(res){
                //如果上传失败
                if(res.code == 400){
                    return layer.msg('上传失败');
                }
                $('.value_image').val(res.data.src);
                //上传成功
            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
        });
    });
</script>
    <!-- 注意：如果你直接复制所有代码到本地，上述js路径需要改成你本地的 -->
    <script type="text/html" id="remb">
        <span style="color: #FF5722">{{d.name}}</span>
    </script>
    <script>
        layui.use(['table','form'], function(){
            var table = layui.table
                ,form = layui.form;
            var $ = layui.$, active = {
                reload: function(){
                    var name = $('input[name="name"]').val();
                    //执行重载
                    table.reload('testReload', {
                        where: {
                            name:name,
                        }
                    });
                }
            };

            $('.demoTable .layui-btn').on('click', function(){
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });

            //监听表格复选框选择
            table.on('checkbox(demo)', function(obj){
                console.log(obj)
            });
            //监听工具条
            table.on('tool(demo)', function(obj){
                var data = obj.data;
                if(obj.event === 'edit'){
                    layer.open({
                        type: 2,
                        title: '编辑',
                        shadeClose: true,
                        shade: false,
                        maxmin: true, //开启最大化最小化按钮
                        area: ['100%', '100%'],
                        content: '<?php echo url("User/userEdit"); ?>?id='+data.id,
                        end: function () {
                            table.reload('testReload');
                        },
                    });
                }else if(obj.event === 'del'){
                    layer.confirm('确定删除么', function(index){
                        $.ajax({
                            url:'<?php echo url("User/delUser"); ?>?id='+data.id,
                            type:'get',
                            dataType:'json',
                            success:function(val){
                                if(val.code ==200){
                                    obj.del();
                                    layer.close(index);
                                }
                                if(val.code==500){
                                    layer.msg(val.msg);
                                }
                            }
                        });

                    });
                }
            });

            $('.addInfo').on('click',function(){
                layer.open({
                    type: 2,
                    title: '添加',
                    shadeClose: true,
                    shade: false,
                    maxmin: true, //开启最大化最小化按钮
                    area: ['100%', '100%'],
                    content: '<?php echo url("User/userAdd"); ?>',
                    end: function () {
                        table.reload('testReload');
                    },
                });
            });
        });
    </script>
    </body>
    </html>